From 80a8257302f00b11613d635284c4d03ef71b430c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 10 Aug 2014 19:05:50 -0400 Subject: [PATCH] Fix reftests for builddir != srcdir Make gtk-reftest consult the REFTEST_MODULE_DIR environment variable to find out where to look for modules, and fix the libtool hack to construct the .libs subdirectory correctly. --- testsuite/reftests/Makefile.am | 1 + testsuite/reftests/gtk-reftest.c | 5 ++++- testsuite/reftests/reftest-module.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/testsuite/reftests/Makefile.am b/testsuite/reftests/Makefile.am index 2607ecc8c7..8501c34ab6 100644 --- a/testsuite/reftests/Makefile.am +++ b/testsuite/reftests/Makefile.am @@ -2,6 +2,7 @@ include $(top_srcdir)/Makefile.decl NULL = TESTS_ENVIRONMENT = \ + REFTEST_MODULE_DIR=$(abs_builddir) \ GTK_IM_MODULE=gtk-im-context-simple \ GSETTINGS_BACKEND=memory \ G_ENABLE_DIAGNOSTIC=0 diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c index d4323346be..a9da81bd58 100644 --- a/testsuite/reftests/gtk-reftest.c +++ b/testsuite/reftests/gtk-reftest.c @@ -381,10 +381,12 @@ connect_signals (GtkBuilder *builder, } break; case 2: + if (g_getenv ("REFTEST_MODULE_DIR")) + directory = g_getenv ("REFTEST_MODULE_DIR"); module = reftest_module_new (directory, split[0]); if (module == NULL) { - g_error ("Could not load module '%s' when looking up '%s'", split[0], handler_name); + g_error ("Could not load module '%s' from '%s' when looking up '%s'", split[0], directory, handler_name); return; } func = reftest_module_lookup (module, split[1]); @@ -438,6 +440,7 @@ snapshot_ui_file (const char *ui_file) gtk_builder_connect_signals_full (builder, connect_signals, directory); window = builder_get_toplevel (builder); g_object_unref (builder); + g_free (directory); g_assert (window); gtk_widget_show (window); diff --git a/testsuite/reftests/reftest-module.c b/testsuite/reftests/reftest-module.c index 536b34d0ec..78fd1833aa 100644 --- a/testsuite/reftests/reftest-module.c +++ b/testsuite/reftests/reftest-module.c @@ -99,7 +99,7 @@ reftest_module_new (const char *directory, if (module == NULL) { /* libtool hack */ - char *libtool_dir = g_build_path (directory, ".libs", NULL); + char *libtool_dir = g_build_filename (directory, ".libs", NULL); g_free (full_path); full_path = g_module_build_path (libtool_dir, module_name); -- 2.30.2